package Aop.Utility;

import Aop.Element.Vector;

public class VectorUtility
{
	public VectorUtility()
	{
		throw new Error("Static Class");
	}
	static public double GetDistance(Vector $p1, Vector $p2)
	{
		return Math.sqrt(($p2.GetX() - $p1.GetX()) * ($p2.GetX() - $p1.GetX()) + ($p2.GetY() - $p1.GetY()) * ($p2.GetY() - $p1.GetY()));
	}
	static public double PixelDistance(Vector $p1, Vector $p2)
	{
		double result = 0;
		
		return result;
	}
	static public double PixelToDegree(Vector $p1, Vector $p2)
	{
		double result = 0;
		Vector vector = $p1.Subtract($p2);
		result = AngleUtility.RevisionDegree(Math.toDegrees(Math.atan2(vector.GetY(), vector.GetX())));
		
		return result;
	}
	
	static public Vector InterpolateForDegree(Vector $position, double $degree, double $distance)
	{
		return InterpolateForRadian($position, Math.toRadians($degree), $distance);
	}
	
	static public Vector InterpolateForRadian(Vector $position, double $radian, double $distance)
	{
		Vector result = new Vector();
		
		result.SetX($position.GetX() + (Math.cos($radian) * $distance));
		result.SetY($position.GetY() + (Math.sin($radian) * $distance));
		
		return result;
	}
}
